<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>JS函数</title>
  </head>
  <body>
    <script>
      // 一、具名函数
      function fn1() {
        console.log("具名函数");
      }
      fn1();

      // 二、匿名函数：赋值给一个变量
      let fn2 = function () {
        console.log("匿名函数");
      };
      fn2();

      // 三、箭头函数
      let fn3 = () => {
        console.log("箭头函数");
      };
      fn3();

      // 四、参数 - 形参与实参
      function printInfo(name, gender = "女", ...args) {
        console.log(name);
        console.log(gender);
        console.log(args);
      }
      printInfo("李华", "男", "6", "8", "9");
      printInfo("李华");
    </script>
  </body>
</html>
